package com.ranjiaqi.map;

import java.util.*;

/**
 * @ClassName TestTreeMap
 * @Description TODO
 * @Author hp
 * @Date 2021/6/25 14:34
 * @Version 1.0
 **/
public class TestTreeMap {
    public static void main(String[] args) {
        stringStudentTreeMap();
    }

    /**
     * TreeMap存储元素
     * 键是字符串，值是Student
     */
    public static void stringStudentTreeMap() {
        Map<String, Person> map = new TreeMap<>();
        map.put("jing", new Person("冉佳奇", 23));
        map.put("tian", new Person("郭德纲", 55));
        map.put("hai", new Person("成龙", 75));

        System.out.println(map);


        Map<Person, String> map1 = new TreeMap<>();
        map1.put(new Person("冉佳奇", 23), "北京市");
        map1.put(new Person("郭德纲", 55), "天津市");
        map1.put(new Person("成龙", 75), "上海市");
        map1.put(new Person("成龙", 75), "上海市");
        System.out.println(map);
    }
}
